package org.example.blog.Mapper;

import org.apache.ibatis.annotations.*;
import org.example.blog.pojo.History;
import java.util.List;

@Mapper
public interface HistoryMapper {
    // 查询所有历史记录
    @Select("select id,name,update_time from history order by update_time desc ")
    List<History> list();

    // 模糊查询
    @Select("select id,name,update_time from history where name like concat('%',#{name},'%') order by update_time desc")
    List<History> search(String name);

    // 新增历史记录
    @Insert("insert into history(name, update_time) values(#{name}, #{updateTime})")
    void insert(History history);

    // 删除历史记录
    @Delete("delete from history where id = #{id}")
    void deleteById(Integer id);
}